<?php

namespace app\api\controller;

use app\admin\model\Lines;
use app\common\controller\Api;
use app\common\library\RedisService;
use phpmailer\PHPMailer;

/**
 * 示例接口
 */
class Demo extends Api
{

    //如果$noNeedLogin为空表示所有接口都需要登录才能请求
    //如果$noNeedRight为空表示所有接口都需要验证权限才能请求
    //如果接口已经设置无需登录,那也就无需鉴权了
    //
    // 无需登录的接口,*表示全部
    protected $noNeedLogin = "*";
    // 无需鉴权的接口,*表示全部
    protected $noNeedRight = "*";

    /**
     * 测试方法
     *
     * @ApiTitle    (测试名称)
     * @ApiSummary  (测试描述信息)
     * @ApiMethod   (POST)
     * @ApiRoute    (/api/demo/test/id/{id}/name/{name})
     * @ApiHeaders  (name=token, type=string, required=true, description="请求的Token")
     * @ApiParams   (name="id", type="integer", required=true, description="会员ID")
     * @ApiParams   (name="name", type="string", required=true, description="用户名")
     * @ApiParams   (name="data", type="object", sample="{'user_id':'int','user_name':'string','profile':{'email':'string','age':'integer'}}", description="扩展数据")
     * @ApiReturnParams   (name="code", type="integer", required=true, sample="0")
     * @ApiReturnParams   (name="msg", type="string", required=true, sample="返回成功")
     * @ApiReturnParams   (name="data", type="object", sample="{'user_id':'int','user_name':'string','profile':{'email':'string','age':'integer'}}", description="扩展数据返回")
     * @ApiReturn   ({
    *'code':'1',
    *'msg':'返回成功'
    *})
     */
     
    public function mail()
    {
        $redis=new RedisService();
        $list=$redis->hgetKeys("equipment_last_request_time");
        setLog(__METHOD__,$list);
        foreach ($list as $k=>$v){
            $last_time=$redis->getHash("equipment_last_request_time",$v);
            $diff_time=time()-$last_time;
            $inc=$redis->get('dxtx_'.$v."_".date("Ymd"));
            if(!$v){
                continue;
            }
            if($diff_time>600 && $inc<3){
                $mailer = new PHPMailer();
                $mailer->CharSet = 'utf-8';
                $mailer->isSMTP();
                $mailer->Host = 'smtp.qq.com';
                $mailer->SMTPAuth = true;
                $mailer->SMTPSecure = 'ssl';
                $mailer->Port = 465;
                $mailer->SMTPAutoTLS = false;
                $mailer->Username="379493943@qq.com";
                $mailer->Password="gfuxjehmolaxcahi";
                $mailer->FromName = "379493943@qq.com";
                $mailer->From="379493943@qq.com";
                $mailer->addAddress("Fiona.Wang@cn.luxottica.com",'Fiona.Wang');
                $mailer->isHTML(true);
                $mailer->Subject = "掉线提醒";
                $mailer->Body = "<p>站点<i style='color: red'>".$v."</i>的设备已经超过十分钟没有联系了</p>";
                if(!$ic || $ic==0){
                    $redis->set("dxtx_".$v."_".date("Ymd"),1,86400);
                }else{
                    $redis->inc("dxtx_".$v."_".date("Ymd"));
                }
            }
        }
    }
    /*线路一全部是胶架厂1*/
    private $linesTimeTable = [
        '2' => [
            ['times' => "07:49", "station" => "办公楼", 'is_end' => false],
            ['times' => "07:51", "station" => "零件", 'is_end' => false],
            ['times' => "07:58", "station" => "物流", 'is_end' => false],
            ['times' => "08:07", "station" => "注塑", 'is_end' => false],
            ['times' => "08:08", "station" => "胶架厂", 'is_end' => false],
            ['times' => "08:09", "station" => "办公楼", 'is_end' => false],
            ['times' => "08:11", "station" => "零件", 'is_end' => false],
            ['times' => "08:19", "station" => "物流", 'is_end' => false],
            ['times' => "08:28", "station" => "注塑", 'is_end' => false],
            ['times' => "08:29", "station" => "胶架厂", 'is_end' => false],
            ['times' => "08:29", "station" => "办公楼", 'is_end' => false],
            ['times' => "08:31", "station" => "零件", 'is_end' => false],
            ['times' => "08:39", "station" => "物流", 'is_end' => false],
            ['times' => "08:47", "station" => "注塑", 'is_end' => false],
            ['times' => "08:48", "station" => "胶架厂", 'is_end' => false],
            ['times' => "08:49", "station" => "办公楼", 'is_end' => false],
            ['times' => "08:51", "station" => "零件", 'is_end' => false],
            ['times' => "08:59", "station" => "物流", 'is_end' => false],
            ['times' => "09:07", "station" => "注塑", 'is_end' => false],
            ['times' => "09:08", "station" => "胶架厂", 'is_end' => false],
            ['times' => "09:09", "station" => "办公楼", 'is_end' => false],
            ['times' => "09:11", "station" => "零件", 'is_end' => false],
            ['times' => "09:19", "station" => "物流", 'is_end' => false],
            ['times' => "09:27", "station" => "注塑", 'is_end' => false],
            ['times' => "09:28", "station" => "胶架厂", 'is_end' => false],
            ['times' => "09:29", "station" => "办公楼", 'is_end' => false],
            ['times' => "09:31", "station" => "零件", 'is_end' => false],
            ['times' => "09:39", "station" => "物流", 'is_end' => false],
            ['times' => "09:47", "station" => "注塑", 'is_end' => false],
            ['times' => "09:48", "station" => "胶架厂", 'is_end' => false],
            ['times' => "09:49", "station" => "办公楼", 'is_end' => false],
            ['times' => "09:51", "station" => "零件", 'is_end' => false],
            ['times' => "09:59", "station" => "物流", 'is_end' => false],
            ['times' => "10:07", "station" => "注塑", 'is_end' => false],
            ['times' => "10:08", "station" => "胶架厂", 'is_end' => false],
            ['times' => "10:09", "station" => "办公楼", 'is_end' => false],
            ['times' => "10:11", "station" => "零件", 'is_end' => false],
            ['times' => "10:19", "station" => "物流", 'is_end' => false],
            ['times' => "10:27", "station" => "注塑", 'is_end' => false],
            ['times' => "10:28", "station" => "胶架厂", 'is_end' => false],
            ['times' => "10:29", "station" => "办公楼", 'is_end' => false],
            ['times' => "10:31", "station" => "零件", 'is_end' => false],
            ['times' => "10:39", "station" => "物流", 'is_end' => false],
            ['times' => "10:47", "station" => "注塑", 'is_end' => false],
            ['times' => "10:48", "station" => "胶架厂", 'is_end' => false],
            ['times' => "10:49", "station" => "办公楼", 'is_end' => false],
            ['times' => "10:51", "station" => "零件", 'is_end' => false],
            ['times' => "10:59", "station" => "物流", 'is_end' => false],
            ['times' => "11:07", "station" => "注塑", 'is_end' => false],
            ['times' => "11:08", "station" => "胶架厂", 'is_end' => false],
            ['times' => "11:09", "station" => "办公楼", 'is_end' => false],
            ['times' => "11:11", "station" => "零件", 'is_end' => false],
            ['times' => "11:19", "station" => "物流", 'is_end' => false],
            ['times' => "14:04", "station" => "办公楼", 'is_end' => false],
            ['times' => "14:06", "station" => "零件", 'is_end' => false],
            ['times' => "14:14", "station" => "物流", 'is_end' => false],
            ['times' => "14:22", "station" => "注塑", 'is_end' => false],
            ['times' => "14:23", "station" => "胶架厂", 'is_end' => false],
            ['times' => "14:24", "station" => "办公楼", 'is_end' => false],
            ['times' => "14:26", "station" => "零件", 'is_end' => false],
            ['times' => "14:34", "station" => "物流", 'is_end' => false],
            ['times' => "14:42", "station" => "注塑", 'is_end' => false],
            ['times' => "14:43", "station" => "胶架厂", 'is_end' => false],
            ['times' => "14:44", "station" => "办公楼", 'is_end' => false],
            ['times' => "14:46", "station" => "零件", 'is_end' => false],
            ['times' => "14:54", "station" => "物流", 'is_end' => false],
            ['times' => "15:02", "station" => "注塑", 'is_end' => false],
            ['times' => "15:03", "station" => "胶架厂", 'is_end' => false],
            ['times' => "15:04", "station" => "办公楼", 'is_end' => false],
            ['times' => "15:06", "station" => "零件", 'is_end' => false],
            ['times' => "15:14", "station" => "物流", 'is_end' => false],
            ['times' => "15:21", "station" => "注塑", 'is_end' => false],
            ['times' => "15:22", "station" => "胶架厂", 'is_end' => false],
            ['times' => "15:24", "station" => "办公楼", 'is_end' => false],
            ['times' => "15:26", "station" => "零件", 'is_end' => false],
            ['times' => "15:34", "station" => "物流", 'is_end' => false],
            ['times' => "15:41", "station" => "注塑", 'is_end' => false],
            ['times' => "15:43", "station" => "胶架厂", 'is_end' => false],
            ['times' => "15:44", "station" => "办公楼", 'is_end' => false],
            ['times' => "15:46", "station" => "零件", 'is_end' => false],
            ['times' => "15:54", "station" => "物流", 'is_end' => false],
            ['times' => "16:01", "station" => "注塑", 'is_end' => false],
            ['times' => "16:03", "station" => "胶架厂", 'is_end' => false],
            ['times' => "16:04", "station" => "办公楼", 'is_end' => false],
            ['times' => "16:06", "station" => "零件", 'is_end' => false],
            ['times' => "16:14", "station" => "物流", 'is_end' => false],
            ['times' => "16:21", "station" => "注塑", 'is_end' => false],
            ['times' => "16:23", "station" => "胶架厂", 'is_end' => false],
            ['times' => "16:24", "station" => "办公楼", 'is_end' => false],
            ['times' => "16:26", "station" => "零件", 'is_end' => false],
            ['times' => "16:34", "station" => "物流", 'is_end' => false],
            ['times' => "16:41", "station" => "注塑", 'is_end' => false],
            ['times' => "16:43", "station" => "胶架厂", 'is_end' => false],
            ['times' => "16:44", "station" => "办公楼", 'is_end' => false],
            ['times' => "16:46", "station" => "零件", 'is_end' => false],
            ['times' => "16:54", "station" => "物流", 'is_end' => false],
            ['times' => "17:01", "station" => "注塑", 'is_end' => false],
            ['times' => "17:03", "station" => "胶架厂", 'is_end' => false],
            ['times' => "17:04", "station" => "办公楼", 'is_end' => false],
            ['times' => "17:06", "station" => "零件", 'is_end' => false],
            ['times' => "17:14", "station" => "物流", 'is_end' => false],
            ['times' => "17:21", "station" => "注塑", 'is_end' => false],
            ['times' => "17:23", "station" => "胶架厂", 'is_end' => false],
            ['times' => "17:24", "station" => "办公楼", 'is_end' => false],
            ['times' => "17:26", "station" => "零件", 'is_end' => false],
            ['times' => "17:34", "station" => "物流", 'is_end' => false],
            ['times' => "17:32", "station" => "注塑", 'is_end' => false],
            ['times' => "17:44", "station" => "胶架厂", 'is_end' => false],
        ],
        /*金属->胶架 1 胶架-》物流0 物流-》胶架0*/
        "3" => [
            ['times' => "07:29", "station" => "金属厂", 'is_end' => false],
            ['times' => "07:34", "station" => "办公楼", 'is_end' => false,'direction'=>0],
            ['times' => "07:36", "station" => "零件", 'is_end' => false],
            ['times' => "07:44", "station" => "物流", 'is_end' => false],
            ['times' => "07:52", "station" => "注塑", 'is_end' => false],
            ['times' => "07:54", "station" => "胶架厂", 'is_end' => false],
            ['times' => "07:59", "station" => "金属厂", 'is_end' => false],
            ['times' => "08:04", "station" => "办公楼", 'is_end' => false,'direction'=>0],
            ['times' => "08:06", "station" => "零件", 'is_end' => false],
            ['times' => "08:14", "station" => "物流", 'is_end' => false],
            ['times' => "08:22", "station" => "注塑", 'is_end' => false],
            ['times' => "08:24", "station" => "胶架厂", 'is_end' => false],
            ['times' => "08:29", "station" => "金属厂", 'is_end' => false],
            ['times' => "08:34", "station" => "办公楼", 'is_end' => false,'direction'=>0],
            ['times' => "08:36", "station" => "零件", 'is_end' => false],
            ['times' => "08:44", "station" => "物流", 'is_end' => false],
            ['times' => "08:52", "station" => "注塑", 'is_end' => false],
            ['times' => "08:54", "station" => "胶架厂", 'is_end' => false],
            ['times' => "08:59", "station" => "金属厂", 'is_end' => false],
            ['times' => "09:04", "station" => "办公楼", 'is_end' => false,'direction'=>0],
            ['times' => "09:06", "station" => "零件", 'is_end' => false],
            ['times' => "09:14", "station" => "物流", 'is_end' => false],
            ['times' => "09:22", "station" => "注塑", 'is_end' => false],
            ['times' => "09:24", "station" => "胶架厂", 'is_end' => false],
            ['times' => "09:29", "station" => "金属厂", 'is_end' => false],
            ['times' => "09:34", "station" => "办公楼", 'is_end' => false,'direction'=>0],
            ['times' => "09:36", "station" => "零件", 'is_end' => false],
            ['times' => "09:44", "station" => "物流", 'is_end' => false],
            ['times' => "09:59", "station" => "外仓", 'is_end' => false],
            ['times' => "10:14", "station" => "物流", 'is_end' => false],
            ['times' => "10:54", "station" => "胶架厂", 'is_end' => false],
            ['times' => "10:59", "station" => "金属厂", 'is_end' => false],
            ['times' => "11:04", "station" => "办公楼", 'is_end' => false,'direction'=>0],
            ['times' => "11:06", "station" => "零件", 'is_end' => false],
            ['times' => "11:14", "station" => "物流", 'is_end' => false],
            ['times' => "11:22", "station" => "注塑", 'is_end' => false],
            ['times' => "11:24", "station" => "胶架厂", 'is_end' => false],
            ['times' => "11:59", "station" => "金属厂", 'is_end' => false],
            ['times' => "11:34", "station" => "办公楼", 'is_end' => false,'direction'=>0],
            ['times' => "11:36", "station" => "零件", 'is_end' => false],
            ['times' => "11:44", "station" => "物流", 'is_end' => false],
            ['times' => "11:52", "station" => "注塑", 'is_end' => false],
            ['times' => "11:54", "station" => "胶架厂", 'is_end' => false],
            ['times' => "12:59", "station" => "办公楼", 'is_end' => false,'direction'=>0],
            ['times' => "13:01", "station" => "零件", 'is_end' => false],
            ['times' => "13:09", "station" => "物流", 'is_end' => false],
            ['times' => "13:17", "station" => "注塑", 'is_end' => false],
            ['times' => "13:19", "station" => "胶架厂", 'is_end' => false],
            ['times' => "13:24", "station" => "金属厂", 'is_end' => false],
            ['times' => "13:29", "station" => "办公楼", 'is_end' => false,'direction'=>0],
            ['times' => "13:31", "station" => "零件", 'is_end' => false],
            ['times' => "13:39", "station" => "物流", 'is_end' => false],
            ['times' => "13:47", "station" => "注塑", 'is_end' => false],
            ['times' => "13:49", "station" => "胶架厂", 'is_end' => false],
            ['times' => "13:54", "station" => "金属厂", 'is_end' => false],
            ['times' => "13:59", "station" => "办公楼", 'is_end' => false,'direction'=>0],
            ['times' => "14:01", "station" => "零件", 'is_end' => false],
            ['times' => "14:09", "station" => "物流", 'is_end' => false],
            ['times' => "14:17", "station" => "注塑", 'is_end' => false],
            ['times' => "14:19", "station" => "胶架厂", 'is_end' => false],
            ['times' => "14:24", "station" => "金属厂", 'is_end' => false],
            ['times' => "14:29", "station" => "办公楼", 'is_end' => false,'direction'=>0],
            ['times' => "14:31", "station" => "零件", 'is_end' => false],
            ['times' => "14:39", "station" => "物流", 'is_end' => false],
            ['times' => "14:47", "station" => "注塑", 'is_end' => false],
            ['times' => "14:49", "station" => "胶架厂", 'is_end' => false],
            ['times' => "14:54", "station" => "金属厂", 'is_end' => false],
            ['times' => "14:59", "station" => "办公楼", 'is_end' => false,'direction'=>0],
            ['times' => "15:01", "station" => "零件", 'is_end' => false],
            ['times' => "15:09", "station" => "物流", 'is_end' => false],
            ['times' => "15:24", "station" => "外仓", 'is_end' => false],
            ['times' => "15:39", "station" => "物流", 'is_end' => false],
            ['times' => "15:47", "station" => "注塑", 'is_end' => false],
            ['times' => "15:49", "station" => "胶架厂", 'is_end' => false],
            ['times' => "15:54", "station" => "金属厂", 'is_end' => false],
            ['times' => "15:59", "station" => "办公楼", 'is_end' => false,'direction'=>0],
            ['times' => "16:01", "station" => "零件", 'is_end' => false],
            ['times' => "16:09", "station" => "物流", 'is_end' => false],
            ['times' => "16:17", "station" => "注塑", 'is_end' => false],
            ['times' => "16:19", "station" => "胶架厂", 'is_end' => false],
            ['times' => "16:49", "station" => "办公楼", 'is_end' => false,'direction'=>0],
            ['times' => "16:51", "station" => "零件", 'is_end' => false],
            ['times' => "16:59", "station" => "物流", 'is_end' => false],
            ['times' => "17:07", "station" => "注塑", 'is_end' => false],
            ['times' => "17:09", "station" => "胶架厂", 'is_end' => false],
            ['times' => "17:09", "station" => "办公楼", 'is_end' => false],
            ['times' => "17:11", "station" => "零件", 'is_end' => false],
            ['times' => "17:24", "station" => "物流", 'is_end' => false],
            ['times' => "17:32", "station" => "注塑", 'is_end' => false],
            ['times' => "17:34", "station" => "胶架厂", 'is_end' => false],
            ['times' => "18:29", "station" => "办公楼", 'is_end' => false,'direction'=>0],
            ['times' => "18:31", "station" => "零件", 'is_end' => false],
            ['times' => "18:39", "station" => "物流", 'is_end' => false],
            ['times' => "18:47", "station" => "注塑", 'is_end' => false],
            ['times' => "18:49", "station" => "胶架厂", 'is_end' => false],
            ['times' => "18:54", "station" => "金属厂", 'is_end' => false],
            ['times' => "18:59", "station" => "办公楼", 'is_end' => false,'direction'=>0],
            ['times' => "19:01", "station" => "零件", 'is_end' => false],
            ['times' => "19:09", "station" => "物流", 'is_end' => false],
            ['times' => "19:17", "station" => "注塑", 'is_end' => false],
            ['times' => "19:19", "station" => "胶架厂", 'is_end' => false],
            ['times' => "19:24", "station" => "金属厂", 'is_end' => false],
            ['times' => "19:29", "station" => "办公楼", 'is_end' => false,'direction'=>0],
            ['times' => "19:31", "station" => "零件", 'is_end' => false],
            ['times' => "19:39", "station" => "物流", 'is_end' => false],
            ['times' => "19:47", "station" => "注塑", 'is_end' => false],
            ['times' => "19:49", "station" => "胶架厂", 'is_end' => false],
            ['times' => "19:54", "station" => "金属厂", 'is_end' => false],
            ['times' => "19:59", "station" => "办公楼", 'is_end' => false,'direction'=>0],
            ['times' => "20:01", "station" => "零件", 'is_end' => false],
            ['times' => "20:09", "station" => "物流", 'is_end' => false],
            ['times' => "20:17", "station" => "注塑", 'is_end' => false],
            ['times' => "20:19", "station" => "胶架厂", 'is_end' => false],
            ['times' => "20:24", "station" => "金属厂", 'is_end' => false],
            ['times' => "20:29", "station" => "办公楼", 'is_end' => false,'direction'=>0],
            ['times' => "20:31", "station" => "零件", 'is_end' => false],
            ['times' => "20:39", "station" => "物流", 'is_end' => false],
            ['times' => "20:47", "station" => "注塑", 'is_end' => false],
            ['times' => "20:49", "station" => "胶架厂", 'is_end' => false],
            ['times' => "20:54", "station" => "金属厂", 'is_end' => false],
            ['times' => "21:09", "station" => "办公楼", 'is_end' => false,'direction'=>0],
            ['times' => "21:11", "station" => "零件", 'is_end' => false],
            ['times' => "21:34", "station" => "物流", 'is_end' => false],
            ['times' => "21:47", "station" => "注塑", 'is_end' => false],
            ['times' => "21:49", "station" => "胶架厂", 'is_end' => false],
        ],
        /**/
        "4" => [
            ['times' => "07:44", "station" => "办公楼", 'is_end' => false],
            ['times' => "07:46", "station" => "零件", 'is_end' => false],
            ['times' => "07:54", "station" => "物流", 'is_end' => false],
            ['times' => "08:02", "station" => "注塑", 'is_end' => false],
            ['times' => "08:04", "station" => "胶架厂", 'is_end' => false],
            ['times' => "08:09", "station" => "金属厂", 'is_end' => false],
            ['times' => "08:14", "station" => "办公楼", 'is_end' => false],
            ['times' => "08:16", "station" => "零件", 'is_end' => false],
            ['times' => "08:24", "station" => "物流", 'is_end' => false],
            ['times' => "08:32", "station" => "注塑", 'is_end' => false],
            ['times' => "08:34", "station" => "胶架厂", 'is_end' => false],
            ['times' => "08:39", "station" => "金属厂", 'is_end' => false],
            ['times' => "08:44", "station" => "办公楼", 'is_end' => false],
            ['times' => "08:46", "station" => "零件", 'is_end' => false],
            ['times' => "08:54", "station" => "物流", 'is_end' => false],
            ['times' => "09:02", "station" => "注塑", 'is_end' => false],
            ['times' => "09:04", "station" => "胶架厂", 'is_end' => false],
            ['times' => "09:09", "station" => "金属厂", 'is_end' => false],
            ['times' => "09:19", "station" => "办公楼", 'is_end' => false],
            ['times' => "09:21", "station" => "零件", 'is_end' => false],
            ['times' => "09:22", "station" => "注塑", 'is_end' => false],
            ['times' => "09:22", "station" => "胶架厂", 'is_end' => false],
            ['times' => "09:31", "station" => "金属厂", 'is_end' => false],
            ['times' => "09:39", "station" => "办公楼", 'is_end' => false],
            ['times' => "09:41", "station" => "零件", 'is_end' => false],
            ['times' => "09:42", "station" => "注塑", 'is_end' => false],
            ['times' => "09:42", "station" => "胶架厂", 'is_end' => false],
            ['times' => "09:49", "station" => "金属厂", 'is_end' => false],
            ['times' => "09:59", "station" => "办公楼", 'is_end' => false],
            ['times' => "10:01", "station" => "零件", 'is_end' => false],
            ['times' => "10:02", "station" => "注塑", 'is_end' => false],
            ['times' => "10:02", "station" => "胶架厂", 'is_end' => false],
            ['times' => "10:09", "station" => "金属厂", 'is_end' => false],
            ['times' => "10:19", "station" => "办公楼", 'is_end' => false],
            ['times' => "10:21", "station" => "零件", 'is_end' => false],
            ['times' => "10:22", "station" => "注塑", 'is_end' => false],
            ['times' => "10:22", "station" => "胶架厂", 'is_end' => false],
            ['times' => "10:29", "station" => "金属厂", 'is_end' => false],
            ['times' => "10:39", "station" => "办公楼", 'is_end' => false],
            ['times' => "10:41", "station" => "零件", 'is_end' => false],
            ['times' => "10:42", "station" => "注塑", 'is_end' => false],
            ['times' => "10:42", "station" => "胶架厂", 'is_end' => false],
            ['times' => "10:49", "station" => "金属厂", 'is_end' => false],
            ['times' => "10:59", "station" => "办公楼", 'is_end' => false],
            ['times' => "11:01", "station" => "零件", 'is_end' => false],
            ['times' => "11:02", "station" => "注塑", 'is_end' => false],
            ['times' => "11:02", "station" => "胶架厂", 'is_end' => false],
            ['times' => "11:09", "station" => "金属厂", 'is_end' => false],
            ['times' => "12:59", "station" => "金属厂", 'is_end' => false],
            ['times' => "13:09", "station" => "办公楼", 'is_end' => false],
            ['times' => "13:11", "station" => "零件", 'is_end' => false],
            ['times' => "13:12", "station" => "注塑", 'is_end' => false],
            ['times' => "13:12", "station" => "胶架厂", 'is_end' => false],
            ['times' => "13:19", "station" => "金属厂", 'is_end' => false],
            ['times' => "13:29", "station" => "办公楼", 'is_end' => false],
            ['times' => "13:31", "station" => "零件", 'is_end' => false],
            ['times' => "13:32", "station" => "注塑", 'is_end' => false],
            ['times' => "13:32", "station" => "胶架厂", 'is_end' => false],
            ['times' => "13:39", "station" => "金属厂", 'is_end' => false],
            ['times' => "13:47", "station" => "办公楼", 'is_end' => false],
            ['times' => "13:49", "station" => "零件", 'is_end' => false],
            ['times' => "13:50", "station" => "注塑", 'is_end' => false],
            ['times' => "13:50", "station" => "胶架厂", 'is_end' => false],
            ['times' => "13:59", "station" => "金属厂", 'is_end' => false],
            ['times' => "14:09", "station" => "办公楼", 'is_end' => false],
            ['times' => "14:11", "station" => "零件", 'is_end' => false],
            ['times' => "14:12", "station" => "注塑", 'is_end' => false],
            ['times' => "14:12", "station" => "胶架厂", 'is_end' => false],
            ['times' => "14:19", "station" => "金属厂", 'is_end' => false],
            ['times' => "14:29", "station" => "办公楼", 'is_end' => false],
            ['times' => "14:31", "station" => "零件", 'is_end' => false],
            ['times' => "14:32", "station" => "注塑", 'is_end' => false],
            ['times' => "14:32", "station" => "胶架厂", 'is_end' => false],
            ['times' => "14:39", "station" => "金属厂", 'is_end' => false],
            ['times' => "14:44", "station" => "办公楼", 'is_end' => false],
            ['times' => "15:14", "station" => "胶架厂", 'is_end' => false],
            ['times' => "15:19", "station" => "金属厂", 'is_end' => false],
            ['times' => "15:29", "station" => "办公楼", 'is_end' => false],
            ['times' => "15:31", "station" => "零件", 'is_end' => false],
            ['times' => "15:32", "station" => "注塑", 'is_end' => false],
            ['times' => "15:32", "station" => "胶架厂", 'is_end' => false],
            ['times' => "15:39", "station" => "金属厂", 'is_end' => false],
            ['times' => "15:47", "station" => "办公楼", 'is_end' => false],
            ['times' => "15:49", "station" => "零件", 'is_end' => false],
            ['times' => "15:50", "station" => "注塑", 'is_end' => false],
            ['times' => "15:50", "station" => "胶架厂", 'is_end' => false],
            ['times' => "15:59", "station" => "金属厂", 'is_end' => false],
            ['times' => "16:09", "station" => "办公楼", 'is_end' => false],
            ['times' => "16:11", "station" => "零件", 'is_end' => false],
            ['times' => "16:12", "station" => "注塑", 'is_end' => false],
            ['times' => "16:12", "station" => "胶架厂", 'is_end' => false],
            ['times' => "16:19", "station" => "金属厂", 'is_end' => false],
            ['times' => "16:29", "station" => "办公楼", 'is_end' => false],
            ['times' => "16:31", "station" => "零件", 'is_end' => false],
            ['times' => "16:32", "station" => "注塑", 'is_end' => false],
            ['times' => "16:32", "station" => "胶架厂", 'is_end' => false],
            ['times' => "16:39", "station" => "金属厂", 'is_end' => false],
            ['times' => "16:47", "station" => "办公楼", 'is_end' => false],
            ['times' => "16:49", "station" => "零件", 'is_end' => false],
            ['times' => "16:51", "station" => "注塑", 'is_end' => false],
            ['times' => "16:51", "station" => "胶架厂", 'is_end' => false],
            ['times' => "16:59", "station" => "金属厂", 'is_end' => false],
            ['times' => "17:09", "station" => "办公楼", 'is_end' => false],
            ['times' => "18:09", "station" => "办公楼", 'is_end' => false],
            ['times' => "18:11", "station" => "零件", 'is_end' => false],
            ['times' => "18:12", "station" => "注塑", 'is_end' => false],
            ['times' => "18:12", "station" => "注塑", 'is_end' => false],
            ['times' => "18:19", "station" => "金属厂", 'is_end' => false],
            ['times' => "18:29", "station" => "办公楼", 'is_end' => false],
        ],
        "5" => [
            ['times' => "07:49", "station" => "金属厂", 'is_end' => false],
            ['times' => "07:59", "station" => "办公楼", 'is_end' => false,'direction'=>0],
            ['times' => "08:01", "station" => "零件", 'is_end' => false],
            ['times' => "08:12", "station" => "物流", 'is_end' => false],
            ['times' => "08:20", "station" => "注塑", 'is_end' => false],
            ['times' => "08:22", "station" => "胶架厂", 'is_end' => false],
            ['times' => "08:31", "station" => "金属厂", 'is_end' => false],
            ['times' => "08:39", "station" => "办公楼", 'is_end' => false,'direction'=>0],
            ['times' => "08:41", "station" => "零件", 'is_end' => false],
            ['times' => "08:42", "station" => "注塑", 'is_end' => false],
            ['times' => "08:42", "station" => "胶架厂", 'is_end' => false],
            ['times' => "08:49", "station" => "金属厂", 'is_end' => false],
            ['times' => "08:59", "station" => "办公楼", 'is_end' => false,'direction'=>0],
            ['times' => "09:01", "station" => "零件", 'is_end' => false],
            ['times' => "09:02", "station" => "注塑", 'is_end' => false],
            ['times' => "09:02", "station" => "胶架厂", 'is_end' => false],
            ['times' => "09:19", "station" => "金属厂", 'is_end' => false],
            ['times' => "09:29", "station" => "办公楼", 'is_end' => false,'direction'=>0],
            ['times' => "09:31", "station" => "零件", 'is_end' => false,'direction'=>0],
            ['times' => "09:32", "station" => "注塑", 'is_end' => false,'direction'=>0],
            ['times' => "09:32", "station" => "胶架厂", 'is_end' => false,'direction'=>0],
            ['times' => "09:34", "station" => "金属厂", 'is_end' => false],
            ['times' => "09:44", "station" => "办公楼", 'is_end' => false,'direction'=>0],
            ['times' => "09:46", "station" => "零件", 'is_end' => false],
            ['times' => "09:47", "station" => "注塑", 'is_end' => false],
            ['times' => "09:47", "station" => "胶架厂", 'is_end' => false,'direction'=>0],
            ['times' => "09:54", "station" => "金属厂", 'is_end' => false],
            ['times' => "09:59", "station" => "办公楼", 'is_end' => false,'direction'=>0],
            ['times' => "10:28", "station" => "办公楼", 'is_end' => false,'direction'=>0],
            ['times' => "10:29", "station" => "零件", 'is_end' => false,'direction'=>0],
            ['times' => "10:30", "station" => "注塑", 'is_end' => false,'direction'=>0],
            ['times' => "10:30", "station" => "胶架厂", 'is_end' => false,'direction'=>0],
            ['times' => "10:34", "station" => "金属厂", 'is_end' => false],
            ['times' => "10:44", "station" => "办公楼", 'is_end' => false,'direction'=>0],
            ['times' => "10:45", "station" => "零件", 'is_end' => false,'direction'=>0],
            ['times' => "10:46", "station" => "注塑", 'is_end' => false,'direction'=>0],
            ['times' => "10:46", "station" => "胶架厂", 'is_end' => false,'direction'=>0],
            ['times' => "10:54", "station" => "金属厂", 'is_end' => false],
            ['times' => "11:04", "station" => "办公楼", 'is_end' => false],
            ['times' => "11:05", "station" => "零件", 'is_end' => false],
            ['times' => "11:06", "station" => "注塑", 'is_end' => false],
            ['times' => "11:06", "station" => "胶架厂", 'is_end' => false],
            ['times' => "11:14", "station" => "金属厂", 'is_end' => false],
            ['times' => "11:19", "station" => "办公楼", 'is_end' => false,'direction'=>0],
            ['times' => "11:21", "station" => "零件", 'is_end' => false,'direction'=>0],
            ['times' => "11:22", "station" => "注塑", 'is_end' => false,'direction'=>0],
            ['times' => "11:22", "station" => "胶架厂", 'is_end' => false,'direction'=>0],
            ['times' => "11:24", "station" => "金属厂", 'is_end' => false],
            ['times' => "11:29", "station" => "办公楼", 'is_end' => false,'direction'=>0],
            ['times' => "11:31", "station" => "零件", 'is_end' => false,'direction'=>0],
            ['times' => "11:32", "station" => "注塑", 'is_end' => false,'direction'=>0],
            ['times' => "11:32", "station" => "胶架厂", 'is_end' => false,'direction'=>0],
            ['times' => "11:39", "station" => "金属厂", 'is_end' => false],
            ['times' => "11:44", "station" => "办公楼", 'is_end' => false,'direction'=>0],
            ['times' => "11:45", "station" => "零件", 'is_end' => false,'direction'=>0],
            ['times' => "11:46", "station" => "注塑", 'is_end' => false,'direction'=>0],
            ['times' => "11:46", "station" => "胶架厂", 'is_end' => false,'direction'=>0],
            ['times' => "11:49", "station" => "金属厂", 'is_end' => false],
            ['times' => "11:54", "station" => "办公楼", 'is_end' => false],
            ['times' => "13:09", "station" => "办公楼", 'is_end' => false,'direction'=>0],
            ['times' => "13:11", "station" => "零件", 'is_end' => false,'direction'=>0],
            ['times' => "13:19", "station" => "物流", 'is_end' => false,'direction'=>0],
            ['times' => "13:32", "station" => "注塑", 'is_end' => false,'direction'=>0],
            ['times' => "13:34", "station" => "胶架厂", 'is_end' => false,'direction'=>0],
            ['times' => "13:44", "station" => "金属厂", 'is_end' => false],
            ['times' => "13:54", "station" => "办公楼", 'is_end' => false],
            ['times' => "13:55", "station" => "零件", 'is_end' => false,'direction'=>0],
            ['times' => "13:56", "station" => "注塑", 'is_end' => false,'direction'=>0],
            ['times' => "13:56", "station" => "胶架厂", 'is_end' => false,'direction'=>0],
            ['times' => "14:04", "station" => "金属厂", 'is_end' => false],
            ['times' => "14:14", "station" => "办公楼", 'is_end' => false],
            ['times' => "14:15", "station" => "零件", 'is_end' => false,'direction'=>0],
            ['times' => "14:16", "station" => "注塑", 'is_end' => false,'direction'=>0],
            ['times' => "14:16", "station" => "胶架厂", 'is_end' => false,'direction'=>0],
            ['times' => "14:24", "station" => "金属厂", 'is_end' => false],
            ['times' => "14:34", "station" => "办公楼", 'is_end' => false],
            ['times' => "14:35", "station" => "零件", 'is_end' => false,'direction'=>0],
            ['times' => "14:36", "station" => "注塑", 'is_end' => false,'direction'=>0],
            ['times' => "14:36", "station" => "胶架厂", 'is_end' => false,'direction'=>0],
            ['times' => "14:44", "station" => "金属厂", 'is_end' => false],
            ['times' => "14:54", "station" => "办公楼", 'is_end' => false],
            ['times' => "14:55", "station" => "零件", 'is_end' => false,'direction'=>0],
            ['times' => "14:56", "station" => "注塑", 'is_end' => false,'direction'=>0],
            ['times' => "14:56", "station" => "胶架厂", 'is_end' => false,'direction'=>0],
            ['times' => "15:04", "station" => "金属厂", 'is_end' => false],
            ['times' => "15:11", "station" => "办公楼", 'is_end' => false],
            ['times' => "15:12", "station" => "零件", 'is_end' => false,'direction'=>0],
            ['times' => "15:13", "station" => "注塑", 'is_end' => false,'direction'=>0],
            ['times' => "15:13", "station" => "胶架厂", 'is_end' => false,'direction'=>0],
            ['times' => "15:24", "station" => "金属厂", 'is_end' => false],
            ['times' => "15:29", "station" => "办公楼", 'is_end' => false],
            ['times' => "15:54", "station" => "办公楼", 'is_end' => false],
            ['times' => "15:55", "station" => "零件", 'is_end' => false,'direction'=>0],
            ['times' => "15:57", "station" => "注塑", 'is_end' => false,'direction'=>0],
            ['times' => "15:57", "station" => "胶架厂", 'is_end' => false,'direction'=>0],
            ['times' => "16:04", "station" => "金属厂", 'is_end' => false],
            ['times' => "16:14", "station" => "办公楼", 'is_end' => false],
            ['times' => "16:15", "station" => "零件", 'is_end' => false,'direction'=>0],
            ['times' => "16:17", "station" => "注塑", 'is_end' => false,'direction'=>0],
            ['times' => "16:17", "station" => "胶架厂", 'is_end' => false,'direction'=>0],
            ['times' => "16:44", "station" => "金属厂", 'is_end' => false],
            ['times' => "16:54", "station" => "办公楼", 'is_end' => false],
            ['times' => "16:55", "station" => "零件", 'is_end' => false,'direction'=>0],
            ['times' => "16:57", "station" => "注塑", 'is_end' => false,'direction'=>0],
            ['times' => "16:57", "station" => "胶架厂", 'is_end' => false,'direction'=>0],
            ['times' => "17:04", "station" => "金属厂", 'is_end' => false],
            ['times' => "17:14", "station" => "办公楼", 'is_end' => false],
            ['times' => "17:15", "station" => "零件", 'is_end' => false,'direction'=>0],
            ['times' => "17:17", "station" => "注塑", 'is_end' => false,'direction'=>0],
            ['times' => "17:17", "station" => "胶架厂", 'is_end' => false,'direction'=>0],
            ['times' => "17:24", "station" => "金属厂", 'is_end' => false],
            ['times' => "17:29", "station" => "办公楼", 'is_end' => false],
            ['times' => "17:30", "station" => "零件", 'is_end' => false,'direction'=>0],
            ['times' => "17:31", "station" => "注塑", 'is_end' => false,'direction'=>0],
            ['times' => "17:31", "station" => "胶架厂", 'is_end' => false,'direction'=>0],
            ['times' => "17:54", "station" => "金属厂", 'is_end' => false],
            ['times' => "18:02", "station" => "办公楼", 'is_end' => false],
            ['times' => "18:03", "station" => "零件", 'is_end' => false,'direction'=>0],
            ['times' => "18:09", "station" => "物流", 'is_end' => false,'direction'=>0],
            ['times' => "18:16", "station" => "注塑", 'is_end' => false,'direction'=>0],
            ['times' => "18:19", "station" => "胶架厂", 'is_end' => false],
        ],
        '6'=>[
            ['times' => "07:29", "station" => "金属厂", 'is_end' => false],
            ['times' => "07:39", "station" => "办公楼", 'is_end' => false],
            ['times' => "07:41", "station" => "零件", 'is_end' => false],
            ['times' => "07:49", "station" => "物流", 'is_end' => false],
            ['times' => "07:59", "station" => "办公楼", 'is_end' => false],
            ['times' => "08:01", "station" => "零件", 'is_end' => false],
            ['times' => "08:09", "station" => "物流", 'is_end' => true],
            ['times' => "17:29", "station" => "物流", 'is_end' => false],
            ['times' => "17:37", "station" => "注塑", 'is_end' => false],
            ['times' => "17:39", "station" => "胶架厂", 'is_end' => false],
            ['times' => "17:49", "station" => "金属厂", 'is_end' => false],
            ['times' => "18:14", "station" => "物流", 'is_end' => true],
            ['times' => "18:22", "station" => "注塑", 'is_end' => false],
            ['times' => "18:24", "station" => "胶架厂", 'is_end' => false],
        ]
    ];
    public function test()
    {
        $redis=new RedisService();
        foreach ($this->linesTimeTable as $key=>$v){
            $redis->setHash("line_time_tables",$key,$v);
            foreach ($v as $value){
                $tt=$redis->getHash("station_line_time_tables_".$value['station'],$key);
                if(!$tt){
                    $tt=array();
                }
                if(!isset($value['direction'])) $value['direction']=1;
                $tt[$value['times']]=$value;
                $redis->setHash("station_line_time_tables_".$value['station'],$key,$tt);
            }
        }
    }
public function export()
    {
        $redis=new RedisService();
        $line_time_tables=$redis->hgetKeys("line_time_tables");
        $lineTable=array();
        foreach ($line_time_tables as $value)
        {
            $lists=$redis->getHash("line_time_tables",$value);
            if ($lists) {
                $lineTable[$value]=$lists;
            }
        }
        file_put_contents(
            EXTEND_PATH."line_time_tables.php",
            '<?php' . "\n\nreturn " . var_export_short($lineTable) . ";\n"
        );
    }
    /**
     * 无需登录的接口
     *
     */
    public function test1()
    {
        $redis=new RedisService();
        $keys=$redis->hgetKeys("station_line_time_tables_金属厂");
        foreach ($keys as $key){
            $lines=Lines::get($key);
        }
        $list=$redis->getHash("station_line_time_tables_金属厂",3);
        dump($list);
    }

    /**
     * 需要登录的接口
     *
     */
    public function test2()
    {
        $this->success('返回成功', ['action' => 'test2']);
    }

    /**
     * 需要登录且需要验证有相应组的权限
     *
     */
    public function test3()
    {
        $this->success('返回成功', ['action' => 'test3']);
    }

}
